Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Bot API 7.0 #300

Merged
merged 3 commits into from
Jan 24, 2024
Merged

Implement Bot API 7.0 #300

merged 3 commits into from
Jan 24, 2024

Conversation

atipugin
Copy link
Owner

No description provided.

@@ -5,7 +5,7 @@ module Bot
module Types
class KeyboardButton < Base
attribute :text, Types::String
attribute? :request_user, KeyboardButtonRequestUser
attribute? :request_users, KeyboardButtonRequestUsers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we really replace (remove the old one)?

The old name will still work for backward compatibility.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I don't know if we should. I plan to release it with 2.0 version, so breaking changes are possible. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see nothing what would break this library. I think the deletion of the old name will be in a new API release. But… it's just for backward compatibility, and we have our own, so it's up to you.

I personally see request_user with KeyboardButtonRequestUsers type kind of confusing.

attribute :request_id, Types::Integer
attribute? :user_is_bot, Types::Bool
attribute? :user_is_premium, Types::Bool
attribute? :max_quantity, Types::Integer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add the default and probably even range validation:

1-10. Defaults to 1.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, added.

@@ -7,7 +7,7 @@ class KeyboardButtonRequestUsers < Base
attribute :request_id, Types::Integer
attribute? :user_is_bot, Types::Bool
attribute? :user_is_premium, Types::Bool
attribute? :max_quantity, Types::Integer.constrained(gteq: 1, lteq: 10).default(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a such "fix"? I'd leave the logic and change the specs.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm too lazy to fix the specs for now. You're free to push changes if you want.

@atipugin atipugin merged commit 8eb0a7c into master Jan 24, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants